/// [Number letter counts](https://projecteuler.net/problem=17)
/// The length of words from 1 to 100
fn main() {
    let words_1_9 = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine"];
    let words_10_19 = [
        "ten",
        "eleven",
        "twelve",
        "thirteen",
        "fourteen",
        "fifteen",
        "sixteen",
        "seventeen",
        "eighteen",
        "nineteen",
    ];
    let words_20_90 = [
        "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety",
    ];
    let words_100 = "hundred";
    let words_1000 = "thousand";

    let length_1_9 = words_1_9.iter().fold(0, |sum, x| sum + x.len());
    let length_10_19 = words_10_19.iter().fold(0, |sum, x| sum + x.len());
    let length_20_90 = words_20_90.iter().fold(0, |sum, x| sum + x.len());

    let length_1_99 = length_1_9 * 9 + length_10_19 + length_20_90 * 10;
    let length_1_999 = length_1_99 * 10 + (length_1_9 + words_100.len() * 9) * 100 + "and".len() * 99 * 9;
    let length_1_1000 = length_1_999 + "one".len() + words_1000.len();

    println!("{} letters would be used", length_1_1000);
}
